package top.kangyaocoding.tech.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import top.kangyaocoding.tech.service.IChatWithMemoryService;

/**
 * 描述: 会话记忆聊天控制器
 *
 * @author K·Herbert
 * @since 2025-04-16 11:45
 */
@Slf4j
@RestController
@RequestMapping("/api/v2/ai")
public class ChatWithMemoryController {

    private final IChatWithMemoryService chatService;

    public ChatWithMemoryController(IChatWithMemoryService chatService) {
        this.chatService = chatService;
    }

    @GetMapping(value = "/chatWithRedisMemory")
    public String chat(@RequestParam String userId, @RequestParam String userMessage) {
        return chatService.chat(userId, userMessage);
    }
}
